package com.example.heuristicallysearchalgorithm49;

import org.junit.Test;

/**
 * @description
 * @auther lijiewei
 * @date 2022/10/21 17:14
 */
public class HeuristicallySearchAlgorithmTest {

    @Test
    public void heuristicallySearchAlgorithmTest() throws Exception{
        //顶点个数
        int count = 11;
        Graph graph = new Graph(count);
        //添加边
        graph.addEdge(0,1, 20);
        graph.addEdge(0,4, 60);
        graph.addEdge(0,5, 60);
        graph.addEdge(0,6, 60);
        graph.addEdge(1,2, 20);
        graph.addEdge(2,3, 10);
        graph.addEdge(3,12, 40);
        graph.addEdge(3,13, 30);
        graph.addEdge(4,8, 50);
        graph.addEdge(4,12, 40);
        graph.addEdge(5,8, 70);
        graph.addEdge(5,9, 80);
        graph.addEdge(5,10, 50);
        graph.addEdge(6,7, 70);
        graph.addEdge(6,13, 50);
        graph.addEdge(7,11, 50);
        graph.addEdge(8,9, 50);
        graph.addEdge(9,10, 60);
        graph.addEdge(10,11, 60);

        //添加顶点
        Node[] nodes = new Node[count];
        nodes[0] = new Node(0, 320, 630);
        nodes[1] = new Node(1, 300, 630);
        nodes[2] = new Node(2, 280, 625);
        nodes[3] = new Node(3, 270, 630);
        nodes[4] = new Node(4, 320, 700);
        nodes[5] = new Node(5, 360, 620);
        nodes[6] = new Node(6, 320, 590);
        nodes[7] = new Node(7, 370, 580);
        nodes[8] = new Node(8, 350, 730);
        nodes[9] = new Node(9, 390, 690);
        nodes[10] = new Node(10, 400, 620);


        System.out.println("s->t表示，s节点到t节点");



        HeuristicallySearchAlgorithm heuristicallySearchAlgorithm = new HeuristicallySearchAlgorithm();
        heuristicallySearchAlgorithm.aStar(graph, 0, 10, nodes);
    }
}
